#include <stdio.h>
#include <assert.h>


const int MAX_st = 1000;
struct st_stack {
       int st_arr [MAX_st];
       int st_counter;
    };
int isfull (st_stack* s);
int isempty (st_stack* s);
int pop (st_stack* s);
void push (st_stack* s, int a);
void st_dump (st_stack* s);
void st_construct (st_stack* s);
void st_destroy (st_stack* s);

int main() {
    st_stack s;
    st_construct (&s);
    push (&s, 6);
    st_dump (&s);
    st_destroy (&s);
    st_dump (&s);
    printf ("%d", s.st_arr[0]);
}
void push (st_stack* s, int a) {
    if (!isfull(s)) printf ("full");
    else {
        s -> st_arr[s -> st_counter] = a;
        s -> st_counter++;
    }
}
int pop (st_stack* s) {
    if (!isempty (s)) printf ("empty");
    else{
        s -> st_counter --;
        return s -> st_arr[s -> st_counter+1];
    }
}
int isempty (st_stack* s) {
    assert (s -> st_counter >= 0);
    if(s -> st_counter == 0) return 0;
    return 1;
}

int isfull (st_stack* s) {
    assert (s -> st_counter <= MAX_st);
    if (s -> st_counter == MAX_st) return 0;
    return 1;
}

void st_construct (st_stack* s) {
    for (int i = 0; i < MAX_st; i ++) s -> st_arr[i] = 0;
    s -> st_counter = 0;
}
void st_dump (st_stack* s){
    for (int i = 0; i < MAX_st; i ++) printf ("%d\n", s -> st_arr[i]);
}

void st_destroy (st_stack* s){
    for (int i = 0; i < MAX_st; i ++) s -> st_arr[i]=-666;
    s -> st_counter = -1;
}

int isOK (st_stack* s){
    assert (s -> st_counter >= 0);
}
